/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.dao;

import br.com.dao.ConnectionFactory;
import br.com.modelo.LoginBean;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

/**
 *
 * @author Felipe
 */
public class LoginDAO {

    private Connection connection;
    LoginBean hb = new LoginBean();

    public LoginDAO() {
        this.connection = new ConnectionFactory().getConnection();
    }

    public boolean getFunc(LoginBean hb) {
        boolean op;
        String log = hb.getLogin();
        String senha=hb.getSenha();
        LoginBean func = new LoginBean();
        
        try {

            PreparedStatement stmt = this.connection
                    .prepareStatement("SELECT * FROM func WHERE login='log'");
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {
                func.setLogin(rs.getString("login"));
                func.setSenha(rs.getString("senha"));

            }
            if (log.equals(func.getLogin())&& senha.equals(func.getSenha()) ) {
                return true;
            } else {
                return false;
            }

        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

    }

}
